#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int count = 0;
	for (int i = 10; i < 100; i++)
	{
		int sum1 = 0,sum2=0;
		int x = i;
		int count1 = 0;
		while (x)
		{
			if (count1 < 1)
				sum1 += x % 10;
			else
				sum2 += x % 10;
			x /= 10;
			count1++;
		}
		if (sum1 == sum2)
			count++;
	}
	
	for (int i = 1000; i < 10000; i++)
	{
		int sum1 = 0, sum2 = 0;
		int x = i;
		int count1 = 0;
		while (x)
		{
			if (count1 < 2)
				sum1 += x % 10;
			else
				sum2 += x % 10;
			x /= 10;
			count1++;
		}
		if (sum1 == sum2)
			count++;
	}

	for (int i = 100000; i < 1000000; i++)
	{
		int sum1 = 0, sum2 = 0;
		int x = i;
		int count1 = 0;
		while (x)
		{
			if (count1 < 3)
				sum1 += x % 10;
			else
				sum2 += x % 10;
			x /= 10;
			count1++;
		}
		if (sum1 == sum2)
			count++;
	}

	for (int i = 10000000; i < 100000000; i++)
	{
		int sum1 = 0, sum2 = 0;
		int x = i;
		int count1 = 0;
		while (x)
		{
			if (count1 < 4)
				sum1 += x % 10;
			else
				sum2 += x % 10;
			x /= 10;
			count1++;
		}
		if (sum1 == sum2)
			count++;
	}
	printf("%d", count);
	return 0;
}